// InputDataDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Property5.h"
#include "InputDataDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CInputDataDlg dialog


CInputDataDlg::CInputDataDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CInputDataDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CInputDataDlg)
	m_inputData = _T("");
	//}}AFX_DATA_INIT

}



void CInputDataDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CInputDataDlg)
	DDX_Text(pDX, IDC_EDIT_INPUTDATA, m_inputData);
	DDV_MaxChars(pDX, m_inputData, 128);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CInputDataDlg, CDialog)
	//{{AFX_MSG_MAP(CInputDataDlg)
	ON_BN_CLICKED(IDC_BUTTON_CANCEL, OnButtonCancel)
	ON_BN_CLICKED(IDC_BUTTON_QUIT, OnButtonQuit)
	ON_BN_CLICKED(IDC_BUTTON_OK, OnButtonOk)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInputDataDlg message handlers

void CInputDataDlg::OnButtonCancel() 
{
	// TODO: Add your control notification handler code here
	m_inputData="";
	UpdateData(false);
	
}

void CInputDataDlg::OnButtonQuit() 
{
	// TODO: Add your control notification handler code here
	
	CDialog::OnCancel();
}

void CInputDataDlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

void CInputDataDlg::OnButtonOk() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
	if(128!=m_inputData.GetLength())
	{
		MessageBox("Data Length Wrong !","Warning");
		return ;
	}
	::PostMessage(m_parentHwnd,WM_MY_MESSAGE,NULL,NULL);
	CDialog::OnCancel();

	


	
}

void CInputDataDlg::SetPhwnd(HWND hwnd)
{
	m_parentHwnd = hwnd;
}
